﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site/QuanTriHeThong/QuanTriHeThong_OffCanvas.Master" AutoEventWireup="true" CodeBehind="TaiKhoan_ChucVu_PhongBan.aspx.cs" Inherits="HospitalManager.QuanTriHeThong.ThietLapHeThong.TaiKhoan_ChucVu_PhongBan" %>

<%@ Register Src="ThietLapHeThong_LeftMenu.ascx" TagName="ThietLapHeThong_LeftMenu" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .search {
            margin-top: 0 !important;
        }
    </style>
    <script src="/AjaxJquery/QuanTriHeThong/ThietLapHeThong/jsTaiKhoan_ChucVu_PhongBan.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
    <uc1:ThietLapHeThong_LeftMenu ID="ThietLapHeThong_LeftMenu1" runat="server" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row">
        <div class="col-xs-12 col-md-12">
            <div class="page-header" style="margin: 0 0 10px;">
                <h1 style="margin: 0; font-weight: bold; color: #3070A7; font-size: 30px;">
                    <small class="breadcrumb" style="font-size: 50%; background-color: #ffffff; padding: 0 15px;">
                        <li><a href="/he-thong/thiet-lap-he-thong">THIẾT LẬP HỆ THỐNG</a></li>
                        <li class="active">CẤU HÌNH TÀI KHOẢN - CHỨC VỤ - PHÒNG BAN</li>
                    </small>
                </h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="form-group">
                <asp:GridView ID="gvDanhSach" runat="server" AutoGenerateColumns="False" Width="100%"
                    CssClass="table table-bordered table-condensed" OnRowDataBound="gvDanhSach_OnRowDataBound"
                    DataKeyNames="ID">
                    <Columns>
                        <asp:BoundField DataField="RowNumber" HeaderText="STT">
                            <ItemStyle HorizontalAlign="Center" Width="3%"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="TaiKhoan" HeaderText="Tài khoản"></asp:BoundField>
                        <asp:BoundField DataField="HoTen" HeaderText="Chủ tài khoản"></asp:BoundField>
                        <asp:BoundField DataField="TenKhoa" HeaderText="Khoa"></asp:BoundField>
                        <asp:BoundField DataField="TenPhongBan" HeaderText="Phòng ban"></asp:BoundField>
                        <asp:BoundField DataField="TenChucVu" HeaderText="Chức vụ"></asp:BoundField>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:LinkButton ID="btnPhanQuyen" runat="server" ToolTip="Phân quyền cho tài khoản" CssClass="btn btn-info btn-sm"
                                    user='<%# Eval("TaiKhoan") %>' OnClientClick="phanquyenkhoaphong(this)" href="javascript:void(0)">
                                        <i class="glyphicon glyphicon-user"></i>
                                </asp:LinkButton>
                                <asp:LinkButton ID="btnChuyenCongTac" runat="server" ToolTip="Điều chuyển công tác" CssClass="btn btn-success btn-sm"
                                    user='<%# Eval("TaiKhoan") %>' maid='<%# Eval("ID") %>' OnClientClick="chuyencongtac(this)" href="javascript:void(0)" Visible="False">
                                        <i class="glyphicon glyphicon-send"></i>
                                </asp:LinkButton>
                                <asp:LinkButton ID="btnDelete" runat="server" ToolTip="Xóa" CssClass="btn btn-danger btn-sm"
                                    CommandArgument='<%# Eval("ID") %>' OnClick="btnDelete_Click" OnClientClick="return showconfirm(this.id);" Visible="False">
                                        <i class="glyphicon glyphicon-trash"></i>
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
        </div>
        <div class="col-md-6" style="text-align: right;">
            <asp:DataList RepeatDirection="Horizontal" runat="server" ID="dlPager" OnItemCommand="dlPager_ItemCommand"
                CssClass="tbPage">
                <ItemTemplate>
                    <asp:LinkButton Enabled='<%#Eval("Enabled") %>' runat="server" ID="lnkPageNo" Text='<%#Eval("Text") %>'
                        CommandArgument='<%#Eval("Value") %>' CommandName="PageNo"></asp:LinkButton>
                </ItemTemplate>
            </asp:DataList>
        </div>
    </div>
    <asp:HiddenField ID="hfPageIndex" runat="server" Value="1" />
    <asp:HiddenField ID="hfTimKiem" runat="server" Value="false" />
    <script type="text/javascript">
        $(function () {
            $("#li_taikhoan_chucvu_phongban").addClass("active");
            $("#li_thietlaphethong").addClass("active");
        });

        var confirmed = false;
        function showconfirm(controlId) {
            if (confirmed) return true;
            bootbox.confirm("Bạn có chắc chắn xóa?", function (result) {
                if (result) {
                    if (controlId != null) {
                        var controlToClick = document.getElementById(controlId);
                        if (controlToClick != null) {
                            confirmed = true;
                            $("#form_Main").validate().cancelSubmit = true;
                            controlToClick.click();
                            confirmed = false;
                        }
                    }
                }
            });
            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="FormContent" runat="server">
    <%--Modal hiển thị popup phân quyền hệ thống--%>
    <div id="div_phanquyen" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static"
        data-width="30%" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" style="line-height: 1;">
                        <span>&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">Phân quyền [Tài khoản: <span id="txtUserName"></span>]</h4>
                </div>
                <div class="modal-body">
                    <form action="" id="form_phanquyen">
                        <div class="row">
                            <div class="form-horizontal">
                                <div class="col-xs-12 col-md-12">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">
                                            Khoa</label>
                                        <div class="col-sm-9">
                                            <select id="ddlKhoa" data-width="100%" data-live-search="true" name="ddlKhoa">
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-horizontal">
                                <div class="col-xs-12 col-md-12">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">
                                            Phòng ban</label>
                                        <div class="col-sm-9">
                                            <select id="ddlPhong" data-width="100%" data-live-search="true" name="ddlPhong">
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-horizontal">
                                <div class="col-xs-12 col-md-12">
                                    <div class="table-responsive">
                                        <table id="tb_chucvu"></table>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row" style="margin-top: 10px;">
                            <div class="form-horizontal">
                                <div class="col-xs-12 col-md-12">
                                    <div class="form-group">
                                        <div class="col-sm-offset-9 col-sm-3">
                                            <input id="btnLuuPhanQuyen" type="button" class="btn btn-info" value="Phân quyền" onclick="luuphanquyen()" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <%--Modal hiển thị popup chuyển công tác--%>
    <div id="div_chuyencongtac" class="modal fade" tabindex="-1" role="dialog" data-backdrop="static"
        data-width="60%" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" style="line-height: 1;">
                        <span>&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">Chuyển công tác [Tài khoản: <span id="txtUserName_ChuyenCongTac"></span>]</h4>
                </div>
                <div class="modal-body">
                    <form action="" id="form_chuyencongtac">
                        <div class="row">
                            <div class="col-xs-6 col-md-6">
                                <div class="row">
                                    <div class="form-horizontal">
                                        <div class="col-xs-12 col-md-12">
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    Khoa</label>
                                                <div class="col-sm-9">
                                                    <select id="ddlKhoa_Cu" data-width="100%" data-live-search="true" name="ddlKhoa_Cu">
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="form-horizontal">
                                        <div class="col-xs-12 col-md-12">
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    Phòng ban</label>
                                                <div class="col-sm-9">
                                                    <select id="ddlPhong_Cu" data-width="100%" data-live-search="true" name="ddlPhong_Cu">
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="form-horizontal">
                                        <div class="col-xs-12 col-md-12">
                                            <div class="table-responsive">
                                                <table id="tb_chucvu_cu"></table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-6 col-md-6">
                                <div class="row">
                                    <div class="form-horizontal">
                                        <div class="col-xs-12 col-md-12">
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    Khoa</label>
                                                <div class="col-sm-9">
                                                    <select id="ddlKhoa_Moi" data-width="100%" data-live-search="true" name="ddlKhoa_Moi">
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="form-horizontal">
                                        <div class="col-xs-12 col-md-12">
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label">
                                                    Phòng ban</label>
                                                <div class="col-sm-9">
                                                    <select id="ddlPhong_Moi" data-width="100%" data-live-search="true" name="ddlPhong_Moi">
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="form-horizontal">
                                        <div class="col-xs-12 col-md-12">
                                            <div class="table-responsive">
                                                <table id="tb_chucvu_moi"></table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row" style="margin-top: 10px;">
                                    <div class="form-horizontal">
                                        <div class="col-xs-12 col-md-12">
                                            <div class="form-group">
                                                <div class="col-sm-offset-8 col-sm-4">
                                                    <input id="btnChuyenCongTac" type="button" class="btn btn-info" value="Chuyển công tác" onclick="luuchuyencongtac()" />
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
